//
//  LMQQ.m
//  15qq
//
//  Created by apple on 15/8/4.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "LMQQ.h"

@implementation LMQQ
- (instancetype) initWithDic:(NSDictionary *) dic
{
    
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

+ (instancetype) qqWithDic:(NSDictionary *) dic
{
    return [[self alloc] initWithDic:dic];
}
+ (NSMutableArray *) qqToList
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"messages" ofType:@"plist"];
    
    NSArray *dicArray = [NSArray arrayWithContentsOfFile:path];
    
    NSMutableArray *marray = [NSMutableArray array];
    
    LMQQ *lastqq;
    for (NSDictionary *dic in dicArray) {
        LMQQ *qq = [LMQQ qqWithDic:dic];
        
        if ([qq.time isEqualToString:lastqq.time]) {
            qq.hiddenTime = YES;
        }
        [marray addObject:qq];
        
        lastqq = qq;
    }
    return marray;
}
@end
